package com.yunzhong.appointment.mapper;


import com.alibaba.fastjson.JSONObject;
import com.yunzhong.appointment.entity.Appointmentorder;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface AppointmentorderMapper {
    int deleteByPrimaryKey(String appointmentId);

    int insert(Appointmentorder record);
    
    int insertSelective(Appointmentorder record);

    Appointmentorder selectByPrimaryKey(String appointmentId);

    int updateByPrimaryKeySelective(Appointmentorder record);

    int updateByPrimaryKey(Appointmentorder record);
	
	/**
	 * @description 将与医生有关的订单外键设置为null
	 * @author 石洪刚
	 * @time 2017年9月11日09:46:28
	 * @param id
	 */
    @Update("UPDATE appointmentorder SET doctor_id = NULL,doctor_name = NULL WHERE doctor_id = #{id}")
	void updateDoctorIdNull(String id);

    List<Appointmentorder> selectCount();


    List<JSONObject> queryPatientAddress(String data);

    /**
     * 查询医生被预约次数统计
     * @return
     */
    List<Map<String, Object>> queryCount();
}